/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						 artifact_prop_effect.h

	$Header: /heroes4/artifact_prop_effect.h $

	$NoKeywords: $

 ************************************************************************/

#if !defined( ARTIFACT_PROP_EFFECT_H_INCLUDED )
#define ARTIFACT_PROP_EFFECT_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "artifact_effect.h"
#include "damage_type.h"

enum t_skill_type;
enum t_spell;
enum t_town_type;

namespace t_artifact_prop
{
	// ----------------------------------------------------------------------
	// template which defines "get_effect()" derived from t_artifact_effect
	// ----------------------------------------------------------------------
	template <t_artifact_effect_type type>
	class t_base : public t_artifact_effect
	{
	public:
		virtual t_artifact_effect_type	get_effect() const;
	};

	template <t_artifact_effect_type type>
	t_artifact_effect_type t_base<type>::get_effect() const
	{
		return type;
	}

	// ----------------------------------------------------------------------
	// template for artifact effects
	// ----------------------------------------------------------------------
	template <class t_base_type, t_artifact_effect_type type>
	class t_effect : public t_base_type
	{
	public:
		t_effect()
		{
		}
		t_effect( t_artifact_target target, int amount = 0 )
		{
			init( target, amount );
		}
		t_effect( t_artifact_target target, int amount, int percentage )
		{
			init( target, amount, percentage );
		}
		t_effect( int amount, bool land, bool sea )
		{
			init( amount, land, sea );
		}
		t_effect( int bonus, int additional_bonus, int levels_per_bonus )
		{
			init( bonus, additional_bonus, levels_per_bonus );
		}
		t_effect( bool melee, bool ranged, t_artifact_target target, int amount = 0 )
		{
			init( melee, ranged, target, amount );
		}

		t_effect( int bonus, int additional_bonus, int levels_per_bonus,
				  bool melee, bool ranged, t_damage_type damage_type = k_damage_normal )
		{
			init( bonus, additional_bonus, levels_per_bonus, melee, ranged, damage_type );
		}
		t_effect( t_town_type alignment, int damage, int health, int speed,
				  t_artifact_target target )
		{
			init( alignment, damage, health, speed, target );
		}
		t_effect( t_spell spell, t_artifact_target target, int amount = 0 )
		{
			init( spell, target, amount );
		}
		t_effect( t_spell spell, int charges, int charge_rate = 2 )
		{
			init( spell, charges, charge_rate );
		}
		t_effect( t_spell spell, bool melee, bool ranged, int chance = 100 )
		{
			init( spell, melee, ranged, chance );
		}
		t_effect( t_skill_type skill, int amount = 0 )
		{
			init( skill, amount );
		}

		virtual t_artifact_effect*		clone() const;
		static  t_artifact_effect*		create();
		virtual t_artifact_effect_type	get_effect() const;
	};

	template <class t_base_type, t_artifact_effect_type type>
	t_artifact_effect* t_effect<t_base_type, type>::create()
	{
		return new t_effect;
	}

	template <class t_base_type, t_artifact_effect_type type>
	t_artifact_effect* t_effect<t_base_type, type>::clone() const
	{
		return new t_effect( *this );
	}

	template <class t_base_type, t_artifact_effect_type type>
	t_artifact_effect_type t_effect<t_base_type, type>::get_effect() const
	{
		return type;
	}

	// ----------------------------------------------------------------------
	// template for most artifact effects
	// ----------------------------------------------------------------------
	typedef t_effect< t_artifact_effect, k_artifact_effect_block>				t_block;
	typedef t_effect< t_artifact_effect, k_artifact_effect_combat_movement>		t_combat_movement;
	typedef t_effect< t_artifact_effect, k_artifact_effect_creature_discount> 	t_creature_discount;
	typedef t_effect< t_artifact_effect, k_artifact_effect_damage>				t_damage;
	typedef t_effect< t_artifact_effect, k_artifact_effect_grail_building>		t_grail_building; 
	typedef t_effect< t_artifact_effect, k_artifact_effect_guardian>			t_guardian; 
	typedef t_effect< t_artifact_effect, k_artifact_effect_health>				t_health;
	typedef t_effect< t_artifact_effect, k_artifact_effect_ignore_enemies>		t_ignore_enemies;
	typedef t_effect< t_artifact_effect, k_artifact_effect_long_weapon>			t_long_weapon;
	typedef t_effect< t_artifact_effect, k_artifact_effect_luck>				t_luck;
	typedef t_effect< t_artifact_effect, k_artifact_effect_magic_resistance>	t_resistance;
	typedef t_effect< t_artifact_effect, k_artifact_effect_mana>				t_mana;
	typedef t_effect< t_artifact_effect, k_artifact_effect_mana_maximum >		t_mana_maximum;
	typedef t_effect< t_artifact_effect, k_artifact_effect_mana_recharge>		t_mana_recharge;
	typedef t_effect< t_artifact_effect, k_artifact_effect_morale>				t_morale;
	typedef t_effect< t_artifact_effect, k_artifact_effect_negate_1st_strike>	t_negate_1st_strike;
	typedef t_effect< t_artifact_effect, k_artifact_effect_negate_immunity>		t_negate_immunity;
	typedef t_effect< t_artifact_effect, k_artifact_effect_negate_mind_immunity>
																			t_negate_mind_immunity;
	typedef t_effect< t_artifact_effect, k_artifact_effect_negate_protection>	t_negate_protection;
	typedef t_effect< t_artifact_effect, k_artifact_effect_no_melee_penalty>	t_no_melee_penalty;
	typedef t_effect< t_artifact_effect, k_artifact_effect_no_range_penalty>	t_no_range_penalty;
	typedef t_effect< t_artifact_effect, k_artifact_effect_no_wall_penalty>		t_no_wall_penalty;
	typedef t_effect< t_artifact_effect, k_artifact_effect_panic>				t_panic;
	typedef t_effect< t_artifact_effect, k_artifact_effect_prohibits_retreat>	t_prohibits_retreat;
	typedef t_effect< t_artifact_effect, k_artifact_effect_ranged_backstab>		t_ranged_backstab;
	typedef t_effect< t_artifact_effect, k_artifact_effect_scouting>			t_scouting;
	typedef t_effect< t_artifact_effect, k_artifact_effect_sea_bonus>			t_sea_bonus;
	typedef t_effect< t_artifact_effect, k_artifact_effect_seamanship>			t_seamanship;
	typedef t_effect< t_artifact_effect, k_artifact_effect_speed>				t_speed;
	typedef t_effect< t_artifact_effect, k_artifact_effect_spell_protection>	t_spell_protection;
	typedef t_effect< t_artifact_effect, k_artifact_effect_stunning_immunity>	t_stunning_immunity;
	typedef t_effect< t_artifact_effect, k_artifact_effect_tactics>				t_tactics;
	typedef t_effect< t_artifact_effect, k_artifact_effect_terrain_mastery>		t_terrain_mastery;

}; // namespace t_artifact_effect_detail

#endif // ARTIFACT_PROP_EFFECT_H_INCLUDED